$(function () {
    all();
});

function all() {
    slf.ajax({
    	url:'/myCenter/getSurplusClassHour',
		contentType : 'application/json;charset=utf-8',
    	success:function(data){
    		console.log(data)
    		console.log("获取剩余课时返回值")
    		var html="";
    		if(data.res==1&&data.obj.length>0){
				for(var i=0;i<data.obj.length;i++){
					var l=data.obj[i];
					if(l.surplusClassHourList.length>0){
						html +='<div class="recordDiv">'
							html +='<div class="recordTitle">'
							html +='<i class="am-icon-user am-icon-sm am-icon-sm" style="color:#BFBFBF;"></i> '   
							html +='<span style="font-size:16px;">'+l.name+'的</span>剩余课时：'  
							html +='</div>'
						for(var j = 0;j < l.surplusClassHourList.length;j++){
							var list=l.surplusClassHourList[j];
							if(list.flag!=0){
									html +='<ul class="courseClass am-margin-0">'
									html +='<li class="courseLi borB-EF">'  
									html +='<div class="courseDivs">'      
									html +='<div class="courseMess">'
									html +='<span class="courSpan text-left" style="color:#333;font-size:14px;">'+list.courseName+'</span>'           
									html +='<span class="courSpan text-center">教室：'+list.className+'</span>'           
									html +='<span class="courSpan text-center">姓名：'+list.childrenName+'</span>'           
									html +='<span class="courSpan text-right">'+list.schoolName+'</span>'           
									html +='</div>'
									html +='<div class="courseStateDiv">剩余课时：<span class="co-26">45分钟</span></div>'
									html +='</div>'      
									html +='<div class="timeDiv">'     
									html +='<span class="timeL">起始时间：'+list.startTime+'-'+list.endTime+'</span>'        
									html +='<span class="teacherDiv">老师点评：无</span>'        
									html +='</div></li></ul></div>'
							}  
						}
					}else if(l.childrenCourse.length>0){
						//课程b
						for(var j = 0;j < l.childrenCoursePage.length;j++){
							var list=l.childrenCoursePage[j];
							if(list.flag!=0){
								html +='<div class="recordDiv">'
									html +='<div class="recordTitle">'
									html +='<i class="am-icon-user am-icon-sm am-icon-sm" style="color:#BFBFBF;"></i> '   
									html +='<span style="font-size:16px;">'+list.childrenName+'的</span>记录：'  
									html +='</div>' 
									html +='<ul class="courseClass am-margin-0">'
									/* html +='<li class="recordLi borB-EF borT-EF">'   
									html +='<span class="recordSf">本月，小明进行了“水彩画基础课”上课10次<span class="co-26">（缺席1次）</span></span>'     
									html +='<span class="recordSt">总体评价<span class="co-26">优</span>希望再接再厉</span>'      
									html +='</li>' */  
									html +='<li class="courseLi borB-EF">'  
									html +='<div class="courseDivs">'      
									html +='<div class="courseMess">'
									html +='<span class="courSpan text-left" style="color:#333;font-size:14px;">'+list.courseName+'</span>'           
									html +='<span class="courSpan text-center">教室：'+list.classroomName+'</span>'           
									html +='<span class="courSpan text-center">姓名：'+list.childrenName+'</span>'           
									html +='<span class="courSpan text-right">'+list.schoolName+'</span>'           
									html +='</div>' 
									if(list.flag==1){
										//已完课
										html +='<div class="courseStateDiv">状态：<span class="co-26">正常</span></div>'
									}else if(list.flag==5){
										//缺席
										html +='<div class="courseStateDiv">状态：<span class="co-red">缺席</span></div>' 
									}       
									html +='</div>'      
									html +='<div class="timeDiv">'     
									html +='<span class="timeL">结束时间：'+list.endTime+'</span>'        
									html +='<span class="teacherDiv">老师点评：无</span>'        
									html +='</div></li></ul></div>' 
							} 
						}
					}else{
						html += '<img src="../img/zwsj.png" alt="img" style="width:100%">';
					}
				}
			}else{
				html += '<img src="../img/zwsj.png" alt="img" style="width:100%">';
			}
    		$('#classTime').html(html);
    	}
    	
    });
}